﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<dynamic>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	Index
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

<script type="text/javascript">
    function CambiarFormaPago() {

        var temp = document.getElementById("NroTarjeta1").style.visibility;
        var temp = document.getElementById("NroTarjeta2").style.visibility;
        var FormaPago = document.form1.FormaPago;
        var indice = FormaPago.selectedIndex;

        if (indice == 0) {
            document.getElementById("NroTarjeta1").style.visibility = "hidden";
            document.getElementById("NroTarjeta2").style.visibility = "hidden";
        } else {
            document.getElementById("NroTarjeta1").style.visibility = "visible";
            document.getElementById("NroTarjeta2").style.visibility = "visible";
        }

    }

</script>
    <h2>Index</h2>
     <form id = "frmSearch" action="/Pago/Search" method="post">
        Número de orden de pago : <input type="text" name="txtOrden" size="15" /> 
        <input type="submit" value="Buscar" />
    </form>
     <% if (ViewData["Paciente"] != null)
        { %>
    <% Html.EnableClientValidation(); %>   
    <% using (Html.BeginForm("RegistrarPago", "Pago", FormMethod.Post, new { id = "form1", name = "form1" }))
       {%>
        <%: Html.ValidationSummary(true)%>
 
    <input type="hidden" id="txtNroOrden" value="<%=ViewData["NroOrden"] %>" />

    <table>
    <tr>
                <td class="text-left">
                    <strong>Datos del paciente </strong>
                </td>
                <td class="text-left">
                    &nbsp;
                </td>
                <td class="text-left">
                    &nbsp;
                </td>
                <td class="text-left">
                    &nbsp;
                </td>
            </tr>
            <tr>
                <td class="text-left">
                    <strong>Código</strong>
                </td>
                <td class="text-left">
                    <span><%=ViewData["Paciente"]%></span>
                </td>
                <td class="text-left">
                    <strong>Nombres</strong>
                </td>
                <td class="text-left">
                    <span><%=ViewData["NombrePaciente"]%></span>
                </td>
            </tr>
            <tr>
                <td class="text-left">
                    <strong>Seguro</strong>
                </td>
                <td class="text-left">
                    <span><%=ViewData["Seguro"]%></span>
                </td>
                <td class="text-left">
                    <strong>Apellidos </strong>
                </td>
                <td class="text-left">
                    <span><%=ViewData["Apellidos"]%></span>
                </td>
            </tr>
            <tr>
                <td colspan="4" class="text-left">
                    &nbsp</td>
            </tr>
            <tr>
                <td class="text-left">
                    <strong>Detalle de orden de pago</strong>
                </td>
                <td class="text-left">
                    &nbsp;
                </td>
                <td class="text-left">
                    &nbsp;
                </td>
                <td class="text-left">
                    &nbsp;
                </td>
            </tr>
            <tr>
                <td colspan="4" class="text-left">
                    <div>
                         <table>
        <tr>
             <th>
               Código de Servicio
            </th>
            <th>
                Descripción de Servicio
            </th>
            <th>
                Cantidad
            </th>
            <th>
                Precio
            </th>
            <th>
                Monto
            </th>
            <th>
                Total
            </th>
            <th>
                Monto Deducible
            </th>
        </tr>
        <% 
         if (TempData["Detalle"] != null)
         {

             foreach (var item in TempData["Detalle"] as List<CI.Caja.BE.BE_OrdenDetalle>)
             { %>
            <tr>
                <td>
                    <%:item.IdServicio%>
                </td>
                <td>
                    <%:item.Descripcion%>
                </td>
                <td>
                    <%:item.Cantidad%>
                </td>
                <td>
                    <%:item.Precio%>
                </td>
                <td>
                    <%:item.SubTotal%>
                </td>
                <td>
                    <%:item.Total%>
                </td>
                <td>
                    <%:item.MontoDeducible%>
                </td>
            </tr>
            <%  }

         }%>
    
    </table>

</div>
                </td>
            </tr>
            <tr>
                <td>
                    &nbsp
                </td>
            </tr>
            <tr>
                <td class="text-left">
                    <strong>Forma de pago </strong>
                </td>
                <td class="text-left">
                    <%: Html.DropDownList("FormaPago", (IEnumerable<SelectListItem>)TempData["FormaPagos"], new { onchange = "CambiarFormaPago();" })%>
                </td>
                <td class="text-left">
                    &nbsp;
                </td>
                <td class="text-left">
                    &nbsp;
                </td>
            </tr>
            <tr >
                <td class="text-left">
                    <div id="NroTarjeta1" style="visibility:hidden;"><strong>Nro de tarjeta</strong></div>
                </td>
                <td class="text-left">
                    <div id="NroTarjeta2" style="visibility:hidden;">
                    <%--<input type="text" id="txtNroTarjeta" />--%>
                    <%: Html.TextBox("txtNroTarjeta")%>
                    </div>
                </td>
                <td class="text-left">
                    &nbsp;
                </td>
                <td class="text-left">
                    &nbsp;
                </td>
            </tr>
              </div>
            <tr>
                <td class="text-left">
                    <strong>Total a pagar </strong>
                </td>
                <td class="text-left">
                    <%--<input type="text" id="txtTotal"
                     value="<%=ViewData["Total"] %>" />--%>
                     <%: Html.TextBox("txtTotal", ViewData["Total"])%>
                </td>
                <td class="text-left">
                    &nbsp;
                </td>
                <td class="text-left">
                    &nbsp;
                </td>
            </tr>
            <tr>
                <td>
                    &nbsp;
                </td>
                <td>
                    &nbsp;
                </td>
                <td>
                    &nbsp;
                </td>
                <td>
                    &nbsp;
                </td>
            </tr>
            <tr>
                <td colspan="4">
                   <!-- <asp:Label ID="lblMsgError" runat="server" ForeColor="Red"></asp:Label>-->
                </td>
            </tr>
        </table>

        <div class="clearfix">
        </div>
        <div>
            <table align="center">
                <tr>
                    <td>
                     <input type="submit" value="Registrar Pago" />
                        </td>
                    <td>
                        <input type="button" value="Imprimir Comprobante" />
                    </td>
                </tr>
            </table> 
        </div>
        <% 
         }
        }  %>
</asp:Content>
